#ifndef RSIM_COORDINATEPROJECTIONUTILS_H
#define RSIM_COORDINATEPROJECTIONUTILS_H

/*-------------------------------------------------------------------------- *
* File: CoordinateProjectionUtils.h                                          *
* Authors: Kishor Bhalerao                                                   *
* Email : kishor8dm@gmail.com                                                *
* Contributors:                                                              *
* Email:                                                                     *
* copyright (c) 2010 Authors.                                                *
*                                                                            *
* This program is free software: you can redistribute it and/or modify it    *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or any later version.*
*                                                                            *
* This program is distributed in the hope that it will be useful, but        *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   *
* for more details. (http://www.gnu.org/licenses/)                           *
* -------------------------------------------------------------------------- */

#include "LinAlgDecl.h"

namespace RSIM{
        
template <class T>class List;        
class Constraint;

class CoordinateProjectionUtils{
        protected:
                void resize_map(const int& n, 
                              List <List <int> >& bmap)const;
                
                void sortSysId(const List <List<int> >& ccouple,
                               const List <Constraint*>& constraints,
                               List <List <int> >& sid)const;                                               
                
                void calcPositionLevelErrorForAllConstraints(List <Constraint*>& constraints)const;
                
                void calcPositionErrorNorms(const Vector *Cq, 
                                            const int& nccouple, 
                                            Vector& PositionErrorNorms)const;
                                            
                void updCoupledConstraintQs(const Vector& delq, 
                                            const List<int>& coup_cons,
                                            List <Constraint*>& constraint)const;
                
                void popuplateCqVector(const List<Constraint*>& constraint, 
                                       const List <List<int> >& ccouple,
                                       Vector *Cq);
                                       
                void calcDelQ(const Matrix *CJac,
                              const Vector *Cq,
                              Vector *delq)const;
                                               
};// class CoordinateProjectionUtils

} // namespace RSIM

#endif